package cn.seaboot.admin.quartz.service;

import cn.seaboot.admin.quartz.bean.ScheduleItem;
import cn.seaboot.admin.quartz.dao.ScheduleItemDao;
import cn.seaboot.commons.core.Snowflake;
import cn.seaboot.commons.core.SnowflakeFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* Service
* 计划任务日志明细 [t_schedule_item]
* @author Mr.css on 2018-6-20
*/
@Service
public class ScheduleItemService {
    private final Snowflake snowflake = SnowflakeFactory.createSnowflake();

    @Resource
    private ScheduleItemDao scheduleItemDao;

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(ScheduleItem pojo){
        pojo.setId(snowflake.nextId());
        return scheduleItemDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param id id
     * @return affected rows
     */
    public int deleteById(String id){
        return scheduleItemDao.deleteById(id);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(ScheduleItem pojo) {
        return scheduleItemDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param logId id
     * @param eventId id
     * @return pojo
     */
    public ScheduleItem queryById(String logId, String eventId){
        return null;
    }

    /**
     * 查列表
     *
     * @param params 参数
     * @return list
     */
    public List<ScheduleItem> queryList(Map<String, Object> params) {
        return scheduleItemDao.selectList(params);
    }
}
